package com.grad.webstudy.model.es;

import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.grad.webstudy.model.Course;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.Date;

/**
 * @Description:
 * @Author: zjf
 * @Date: 2020/4/1 10:09.
 */
@Document(indexName = "course", type = "doc")
public class ESCourse implements Serializable {

    @Id
    private Integer id;


    @JsonAlias("class_name")
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String className;

    @Field(type = FieldType.Float)
    private Float score;

    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String teacher;

    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String introduction;


    @JsonAlias("study_number")
    @Field(type = FieldType.Long)
    private Integer studyNumber;

    @JsonAlias("type_id")
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String typeId;


    @JsonAlias("score_user")
    @Field(type = FieldType.Long)
    private Integer scoreUser;

    @Field(type = FieldType.Long)
    private Integer level;


    @JsonAlias("cover_path")
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String coverPath;

    @Field(type = FieldType.Long)
    private Integer status;

    @JsonAlias("create_time")
    @Field(type = FieldType.Date)
    private Date createTime;

    @JsonAlias("base_knowledge")
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String baseKnowledge;

    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String learn;

    @JsonAlias("update_time")
    @Field(type = FieldType.Date)
    private Date updateTime;

    public ESCourse() {
    }


    public ESCourse(Course course) {
        this.id = course.getId();
        this.className = course.getClassName();
        this.score = course.getScore();
        this.teacher = course.getTeacher();
        this.introduction = course.getIntroduction();
        this.studyNumber = course.getStudyNumber();
        this.typeId = course.getTypeId();
        this.scoreUser = course.getScoreUser();
        this.level = course.getLevel();
        this.coverPath = course.getCoverPath();
        this.status = course.getStatus();
        this.createTime = course.getCreateTime();
        this.baseKnowledge = course.getBaseKnowledge();
        this.learn = course.getLearn();
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public Float getScore() {
        return score;
    }

    public void setScore(Float score) {
        this.score = score;
    }

    public String getTeacher() {
        return teacher;
    }

    public void setTeacher(String teacher) {
        this.teacher = teacher;
    }

    public String getIntroduction() {
        return introduction;
    }

    public void setIntroduction(String introduction) {
        this.introduction = introduction;
    }

    public Integer getStudyNumber() {
        return studyNumber;
    }

    public void setStudyNumber(Integer studyNumber) {
        this.studyNumber = studyNumber;
    }

    public String getTypeId() {
        return typeId;
    }

    public void setTypeId(String typeId) {
        this.typeId = typeId;
    }

    public Integer getScoreUser() {
        return scoreUser;
    }

    public void setScoreUser(Integer scoreUser) {
        this.scoreUser = scoreUser;
    }

    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public String getCoverPath() {
        return coverPath;
    }

    public void setCoverPath(String coverPath) {
        this.coverPath = coverPath;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getBaseKnowledge() {
        return baseKnowledge;
    }

    public void setBaseKnowledge(String baseKnowledge) {
        this.baseKnowledge = baseKnowledge;
    }

    public String getLearn() {
        return learn;
    }

    public void setLearn(String learn) {
        this.learn = learn;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}
